#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright @ 2014 OPS, Qunar Inc. (qunar.com)
#
# Author: tingfang.bao <tingfang.bao@qunar.com>
# DateTime: 15-3-10 下午12:12
from flask import Flask


# noinspection PyShadowingNames
def create_app(config_filename):
    app = Flask(__name__)
    app.config.from_pyfile(config_filename)

    print app.config['SQLALCHEMY_DATABASE_URI']

    # 支持Flask-SQLAlchemy
    from model import db

    db.init_app(app)

    # 注册blueprint
    from admin import admin_bp

    app.register_blueprint(admin_bp)

    return app


app = create_app("./settings.cfg")


@app.route('/')
def index():
    return 'hello'


if __name__ == '__main__':
    app.run(port=8080)